<extend name="default/template/base_20160803" />
<block name="area_header">
	<link rel="stylesheet" href="__PUBLIC__/Webview/css/viewpage/baoshuiqu.css?v20160828"/>
	<link rel="stylesheet" href="__PUBLIC__/Webview/js/dropload/0.9.0/dropload.css"/>
	<script type="text/javascript" src="__PUBLIC__/Webview/js/dropload/0.9.0/dropload.min.js"></script>
</block>
<block name="area_body">
	<div class="content-bar border-bottom">
		<ul class="nav nav-pills">
			<li>
				<if condition="I('order',11) eq 11">
					<a href="javascript:void(0);" class="selected">人气</a>
					<else/>
					<a href="{:U('webview/viewPage/index',array('block'=>I('block'),'banner'=>I('banner'),'order'=>11))}">人气</a>
				</if>
			</li>
			<li>
				<if condition="I('order',11) eq 12">
					<a href="javascript:void(0);" class="selected">销量</a>
					<else/>
					<a href="{:U('webview/viewPage/index',array('block'=>I('block'),'banner'=>I('banner'),'order'=>12))}">销量</a>
				</if>
			</li>
			<li>
				<if condition="I('order',11) eq 15">
					<a href="javascript:void(0);" class="selected">新品</a>
					<else/>
					<a href="{:U('webview/viewPage/index',array('block'=>I('block'),'banner'=>I('banner'),'order'=>15))}">新品</a>
				</if>
			</li>
			<li class="dropdown">
				<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0);">价格区间<span class="caret"></span></a>
				<ul class="dropdown-menu">
					<li>
						<if condition="I('price') eq 10">
							<a href="javascript:void(0);">0-500</a>
							<else/>
							<a href="{:U('webview/viewPage/index',array('block'=>I('block'),'banner'=>I('banner'),'order'=>I('order,11'),'price'=>10))}">0-500</a>
						</if>
					</li>
					<li>
						<if condition="I('price') eq 11">
							<a href="javascript:void(0);">500-1000</a>
							<else/>
							<a href="{:U('webview/viewPage/index',array('block'=>I('block'),'banner'=>I('banner'),'order'=>I('order,11'),'price'=>11))}">500-1000</a>
						</if>
					</li>
					<li>
						<if condition="I('price') eq 10">
							<a href="javascript:void(0);">1000以上</a>
							<else/>
							<a href="{:U('webview/viewPage/index',array('block'=>I('block'),'banner'=>I('banner'),'order'=>I('order,11'),'price'=>12))}">1000以上</a>
						</if>
					</li>
				</ul>
			</li>
		</ul>
	</div>
	<div class="product-list">
		<div class="list-wrap">
			<volist name="product_info.list" id="vo">
				<div class="product-msg">
					<a href="com.moodwo.mengwu://?type=MENGWU_PRODUCT_DETAIL&pid={$vo.product_id}&groupid={$group_id}">
						<div class="sp-img"><img src="{$vo.img}"></div>
						<div class="sp-detail">
							<div class="pro-txt-msg"><span class="national">国际</span>保税区直发&nbsp;&nbsp;{$vo.name}</div>
							<div class="express"><span style="display: none">运费￥20</span><span class="country">{$vo.country}</span></div>
							<div class="other">
								<span class="price">￥{$vo.group_price}</span>
								<span class="buy-num" style="display: none;">285人付款</span>
							</div>
						</div>
					</a>
				</div>
			</volist>
		</div>
	</div>

</block>
<block name="area_footer">
	<script type="text/javascript">
		var p_ids = {$p_ids};
		$(function(){
			var counter = 2;
			// 每页展示10个
			var num = 10;
			var group_id = {$group_id};

			// dropload
			$('.product-list').dropload({
				scrollArea : window,
				loadDownFn : function(me){
					$.ajax({
						type: 'POST',
						url: "{:U('webview/viewPage/queryProduct')}",
						data:{ids:p_ids,curpage:counter,size:num,group_id:group_id},
						dataType: 'json',
						success: function(data){

							if(data.status){
								var result = '';
								counter++;
								var list = data.info.list;

								for(var i = 0; i < list.length; i++){
									result += '<div class="product-msg"> ' +
											'<a href="com.moodwo.mengwu://?type=MENGWU_PRODUCT_DETAIL&pid='+list[i].product_id+'&groupid={$group_id}"> ' +
											'<div class="sp-img"><img src="'+list[i].img+'"></div> ' +
											'<div class="sp-detail"> ' +
											'<div class="pro-txt-msg"><span class="national">国际</span>保税区直发&nbsp;&nbsp;'+list[i].name+'</div> ' +
											'<div class="express"><span style="display: none">运费￥20</span><span class="country">'+list[i].country+'</span></div> ' +
											'<div class="other"> ' +
											'<span class="price">￥'+list[i].group_price+'</span> ' +
											'<span class="buy-num" style="display: none;">285人付款</span></div></div></a></div>';

								}

								if(counter*num >= data.info.count){
									// 锁定
									me.lock();
									// 无数据
									me.noData();
								}

								$('.list-wrap').append(result);
								// 每次数据加载完，必须重置
								me.resetload();

							}

						},
						error: function(xhr, type){
							alert('Ajax error!');
							// 即使加载出错，也得重置
							me.resetload();
						}
					});
				}
			});
		});
	</script>

</block>